/***********************************************************

Filename: Database.h

Description:

This class stores all data including flags for UI, ROI vertices, etc.
It uses Singleton to ensure only one instance is created.

Author: Shaoting Zhang

***********************************************************/

#ifndef _DATABASE_H___
#define _DATABASE_H___
#include "TriMesh.h"
#include "TriMesh.h"
#include <queue>
#include <vector>
#include "math/Vector3.h"
#include <XnCppWrapper.h>


//#include <QGLViewer/qglviewer.h>

/*#define GLViewer QGLViewer
#define Point2D QPoint*/

class Database
{
protected:
	Database(void);
	static Database* _instance;
	static int _refCount;
public:
	static Database* getInstance();
	static void Release();
	static void Destroy();
	~Database(void);

	
	// for mesh statistics 
	// [0]: percentage of regular vertices (having 6 neighbors)
	// radius ratio, [1]: Tmin, [2]: Tmean
	// minimum angles in triangles: [3]: min angle, [4]: mean angle
	std::vector<double> meshStat; 
	// for deformation purpose
	std::vector<TriMesh::VHandle> controlPts; // control points, for deformation
	std::vector<TriMesh::VHandle> anchorPts; // anchor points, for deformation
	// Data:
	TriMesh* themesh; // the mesh used in this program
	TriMesh* meshCopy; // keep a copy for reset purpose
	//
	int smoothLSOWeight;
	int smoothLSOAnchor; // smooth parameters

	XnPoint3D* NIJoint2D;
	XnPoint3D* NIJoint3D;

	std::queue<std::vector<Vector3>> jointQueue;
};

#endif
